package com.neuedu.yyzx.controller;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.yyzx.config.CommonResult;

import com.neuedu.yyzx.entity.DoctorInformation;
import com.neuedu.yyzx.service.IDoctorInformationService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 医生信息 前端控制器
 * </p>
 *
 * @author 第7组....
 * @since 2021-05-18
 */
@RestController
@RequestMapping("//doctorInformation")
public class DoctorInformationController {

    @Autowired
    IDoctorInformationService service;

    @RequestMapping("/list")
    public CommonResult list(@RequestParam(defaultValue = "1") Integer pageNo , @RequestParam(defaultValue = "10") Integer pageSize){

        return CommonResult.success(service.page(new Page<>(pageNo,pageSize)));

    }

    @RequestMapping("/toAdd")
    CommonResult toAdd(DoctorInformation doctorInformation){
        return CommonResult.success(service.saveOrUpdate(doctorInformation));
    }

    @RequestMapping("/update")
    CommonResult update(Integer id){
        return CommonResult.success(service.getById(id));
    }

    @RequestMapping("/del")
    CommonResult deleteById(Integer id) {
        return CommonResult.success((service.removeById(id)));
    }
}
